{template Public:Page:header}
<div class="container">
    
<div class="row">
     
    <div class="row">
      <div class="col-lg-9">
        <div class="well" style="background:#FFF">
        
        
        <div class="row">
              <div class="col-lg-12 col-sm-12 col-xs-12">
                <div class="wizard wizard-wired">
                  <ul class="steps">
                    <li class="active" data-target="#wiredstep1"><span class="step">1</span><span class="title">填写需求信息</span> <span class="chevron"></span></li>
                    <li data-target="#wiredstep2"><span class="step">2</span><span class="title">设置赏金</span> <span class="chevron"></span></li>
                    <li data-target="#wiredstep3"><span class="step">3</span><span class="title">确认并托管</span> <span class="chevron"></span></li>
                  </ul>
                </div>
              </div>
        </div>
    
            <br />
        <div class="row"> 
        <div class="col-lg-11 col-lg-offset-1"> 
        
          <form data-bv-feedbackicons-validating="glyphicon glyphicon-refresh" data-bv-feedbackicons-invalid="glyphicon glyphicon-remove" data-bv-feedbackicons-valid="glyphicon glyphicon-ok" class="form-horizontal bv-form" id="TaskForm" novalidate="novalidate">
          
          {template Task:Publish:form}
          
		<div class="row">
               <div class="col-lg-12">
               	<div class="row"><button class="btn btn-success" type="submit">下一步</button></div>
               </div>
            </div>

          <input type="hidden" name="datatype" value="json"/>
          <input type="hidden" name="Submit" value="true"/>
          <input type="hidden" name="catid" id="Catid" value="{if !empty($manage['catid'])}{echo $manage['catid']}{/if}"/>
          <input type="hidden" name="id" value="{echo $id}"/>
           
          </form>
          

</div>
</div>


<script src="{echo AURL}/js/validation/bootstrapValidator.js"></script>
<script src="{echo AURL}/js/datetime/bootstrap-datepicker-{echo C('DEFAULT_LANG')}.js"></script>
<script>							
$(function(){
	
			 var um = UM.getEditor('Content');
			 
			 um.addListener("contentChange",function(){
				if(UM.getEditor('Content').hasContents()){
					$('#TaskForm button[type="submit"]').attr('disabled',false);
				}
			 });
			  
			 $("#TaskCategory").click( function () { $('#TaskForm button[type="submit"]').attr('disabled',false); }); 
				
			//分类
		  SetFormCategory(AURL+"/js/foxphp_json_task_category.js",'#TaskCategory');

 		  $('#TaskForm').bootstrapValidator({
                excluded: [':disabled'],
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
				fields: {
					subject: {
						validators: {
							notEmpty: {
								message: '任务标题不能为空！'
							},
							stringLength: {
								min: 5,
								max: 100,
								message: '标题最少5个字到100字内！'
							}
						}
					},
					phone: {
						validators: {
							notEmpty: {
								message: '联系电话不能为空！'
							},
							regexp: {
								regexp: /^[0-9]+$/,
								message: '联系电话格式有误！'
							}
						}
					}
					
				},
                submitHandler: function (form) {
					
					var catid=$("#Catid").val();
					if(catid<1){
						 bootbox.alert({ 
							size: 'small',
							message: "请选择任务分类！"
						})
						 return false; 
					 }
									 
				 if(!UM.getEditor('Content').hasContents()){
					 bootbox.alert({ 
						size: 'small',
						message: "请填写任务需求！"
					 })
					 return false; 
				 }
									 
				  var postaction=$('input[name="id"]').val() > 0 ? 'publishedit' : 'publishinsert';

				  $.post('{echo U("/post/task")}/'+postaction,$("#TaskForm").serialize(), function(json) {
					
					  	$('.bootbox').PhpappProgress({json:json});

				 		return true;
					
				  }, 'json');
				  

				 bootbox.dialog({
					 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
					 title: '<i class="icon fa fa-retweet"></i> 提交中',
					 closeButton: false
				 }).PhpappProgress({time:2000});
			 
				  return false; 
				 
                } 
			
            }) 

        });
	   

</script>


        </div>
      </div>
      <div class="col-lg-3">
        <div class="well" style="background:#FFF">
  
          <h3 class="text-success">联系客服帮您发需求</h3>
          <h4>客服电话 400-000-000 </h4>
          <p class="label label-default">周一至周日9:00-23:00</p>
          <p>联系在线客服</p>
          <p class="label label-default">周一至周五9:00-18:00</p>
   
        </div>
      </div>
    </div>

</div>
</div>



<!--Page Related Scripts-->
<script src="{echo AURL}/js/validation/bootstrapValidator.js"></script>

<!--Bootstrap Date Picker-->
<script src="{echo AURL}/js/datetime/bootstrap-datepicker-{echo C('DEFAULT_LANG')}.js"></script>
<script>

        $(document).ready(function () {
		   
		   $('.date-picker').datepicker();

 		  $('#TaskForm').bootstrapValidator({
                excluded: [':disabled'],
                feedbackIcons: {
                    valid: 'glyphicon glyphicon-ok',
                    invalid: 'glyphicon glyphicon-remove',
                    validating: 'glyphicon glyphicon-refresh'
                },
                submitHandler: function (form) {

				  $.post('{echo U("/ajax/task/add/id/".$this->id."/catid/".$this->catid)}',$("#TaskForm").serialize(), function(json) {
					
					  	$('.bootbox').PhpappProgress({json:json});

				 		return true;
					
				  }, 'json');
				  

				 bootbox.dialog({
					 message: '<div class="progress progress-striped active"><div style="width: 1%" aria-valuemax="100" aria-valuemin="0" aria-valuenow="20" role="progressbar" class="progress-bar progress-bar-info"><span>0%</span></div></div>',
					 title: '<i class="icon fa fa-retweet"></i> 提交中',
					 closeButton: false
				 }).PhpappProgress({time:1000});
			 
				  return false; 
				 
                } 
			
            }) 

        });
	   


    </script>
    


{template Public:Page:footer}